import { ArrowLeftOutlined } from '@ant-design/icons';
import { history } from 'umi';
import './index.less';

interface IProps {
  label?: string | React.ReactNode;
  onClick?: () => void;
}
const BackBtn: React.FC<IProps> = (props) => {
  const { label = '返回', onClick } = props;
  const handleBack = () => {
    history.goBack();
    onClick && onClick();
  };
  return (
    <div className="back_btn" onClick={() => handleBack()}>
      <ArrowLeftOutlined />
      <span>{label}</span>
    </div>
  );
};

export default BackBtn;
